package com.cy.pj.common.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 用于封装分析信息的pojo对象
 */
@Data
@NoArgsConstructor
public class PageObject<T> implements Serializable {
    private static final long serialVersionUID = -6010170587490380722L;
    private Integer rowCount;// 总记录数
    private Integer pageSize;// 页面大小 -- 每页最多显示的记录数
    private Integer pageCount;// 总页数
    private Integer pageCurrent;// 当前页面值
    private List<T> records;// 当前页记录

    public PageObject(Integer rowCount, Integer pageSize, Integer pageCurrent, List<T> records) {
        this.rowCount = rowCount;
        this.records = records;
        this.pageSize = pageSize;
        this.pageCurrent = pageCurrent;
        this.pageCount = rowCount % pageSize == 0 ? rowCount / pageSize : rowCount / pageSize + 1;
    }
}
